/**
 * 文件名：AdServiceImpl.java
 *
 * 版本信息：
 * 日期：Sep 2, 2009
 * Copyright dp Corporation 2009 
 * 版权所有 2009All rights reserved.
 * 创建者：
 *
 */
package com.dp.service.impl3;

import java.util.ArrayList;
import java.util.List;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;

import com.dp.pojo.JsonPage;
import com.dp.pojo.TjIphoneWeek;

/**
 * 
 * 项目名称：platform_p2
 * 类名称：AdServiceImpl3
 * 类描述：
 * 创建人：Administrator
 * 创建时间：Sep 2, 2009 8:29:47 PM
 * 修改人：Administrator
 * 修改时间：Sep 2, 2009 8:29:47 PM
 * 修改备注：
 * @version 
 * 
 */
@Service

public class NewstjiphoneweekServiceImpl3 extends com.dp.service.impl3.BaseImpl {
	private static Logger log = Logger.getLogger(NewstjiphoneweekServiceImpl3.class);
//	public List<TjIphoneWeek> findIphoneWeek(JsonPage jpage,String begintimepage,String endtimepage,
//			int firstrow, int maxrow) {
//		log.info("排序时从action上传来的参数有：");
//		log.info("begintimepage="+begintimepage);
//		log.info("endtimepage="+endtimepage);
//		
//		String sql = "SELECT ntid.* FROM news_tj_iphone_week ntid where ntid.id=ntid.id";
//		
//		if(begintimepage != null && !"".equals(begintimepage)) {
//			sql += " and ntid.begin_date > '" + begintimepage + "'";
//		}
//		if(endtimepage != null && !"".equals(endtimepage)) {
//			sql += " and ntid.end_date < '" + endtimepage + "'";
//		}
//		if(jpage!=null){
//			if(jpage.getSidx()!=null&&!"".equals(jpage.getSidx())){
//				sql += " order by ntid."+jpage.getSidx();
//						
//			    sql+=" "+jpage.getSord();
//			    log.info("jpage.getSord()返回的值是"+jpage.getSord());
//			}
//		}
//		sql += " limit " +firstrow+","+maxrow;
//		log.info(" findIphoneWeek excute sql : " +sql);
//		List result = new ArrayList();;
//		try {
////			this.init();
////			this.rs1 = stmt.executeQuery(sql);
////			while(rs1.next())
////			{	
////				int j = 1;
////				TjIphoneWeek tjIphoneWeek = new TjIphoneWeek();
////				log.info("从数据库查询获得的第一个参数:"+rs1.getString(1));
////				tjIphoneWeek.setId(rs1.getInt(j++));
////				tjIphoneWeek.setProvider(rs1.getString(j++));
////				tjIphoneWeek.setProvider_country(rs1.getString(j++));
////				tjIphoneWeek.setVendor_identifier(rs1.getString(j++));
////				tjIphoneWeek.setUpc(rs1.getString(j++));
////				tjIphoneWeek.setIsrc(rs1.getString(j++));
////				tjIphoneWeek.setArtist_show(rs1.getString(j++));
////				tjIphoneWeek.setTitle_episode_season(rs1.getString(j++));
////				tjIphoneWeek.setLabel_studio_network(rs1.getString(j++));
////				tjIphoneWeek.setProduct(rs1.getInt(j++));
////				tjIphoneWeek.setUnits(rs1.getInt(j++));
////				tjIphoneWeek.setRoyalty_price(rs1.getInt(j++));
////				tjIphoneWeek.setBegin_date(rs1.getDate(j++));
////				tjIphoneWeek.setEnd_date(rs1.getDate(j++));
////				tjIphoneWeek.setCustomer_currency(rs1.getString(j++));
////				tjIphoneWeek.setCountry_code(rs1.getString(j++));
////				tjIphoneWeek.setRoyalty_currency(rs1.getString(j++));
////				tjIphoneWeek.setPreoder(rs1.getString(j++));
////				tjIphoneWeek.setSeason_pass(rs1.getString(j++));
////				tjIphoneWeek.setIsan(rs1.getString(j++));
////				tjIphoneWeek.setApple_identifier(rs1.getString(j++));
////				tjIphoneWeek.setCustomer_price(rs1.getInt(j++));
////				tjIphoneWeek.setCma(rs1.getString(j++));
////				tjIphoneWeek.setAsset_content_flavor(rs1.getString(j++));
////				tjIphoneWeek.setVendor_offer_code(rs1.getString(j++));
////				tjIphoneWeek.setQrid(rs1.getString(j++));
////				tjIphoneWeek.setPromo_code(rs1.getString(j++));
////				tjIphoneWeek.setParent_identifier(rs1.getString(j++));
////				
////				
////				result.add(tjIphoneWeek);
////			}
//		} catch (Exception e) {
//			log.info(" findIphoneWeek fail !!!" +e.getMessage());
//			e.printStackTrace();
//		}
//
//		return result;
//	}
	
	public int findIphoneWeekCount(String begintimepage,String endtimepage) {
		sql = "SELECT count(nt.id) FROM news_tj_iphone_week nt where nt.id=nt.id";
		if(begintimepage != null && !"".equals(begintimepage)) {
			sql += " and nt.begin_date > '" + begintimepage + "'";
		}
		if(endtimepage != null && !"".equals(endtimepage)) {
			sql += " and nt.end_date < '" + endtimepage + "'";
		}
		log.info(" findTjIphoneWeek excute sql : " +sql);
		int i = 0;
		try {
		
				i =this.getOneInt();
		} catch (Exception e) {
			log.info(" findTjIphoneWeek fail !!!" +e.getMessage());
			e.printStackTrace();
		}
		
		return i;
	}
	


}
